package com.ke.searchhouse.service;

import com.ke.searchhouse.dto.HouseDTO;
import com.ke.searchhouse.form.DatatableSearch;
import com.ke.searchhouse.form.HouseForm;
import com.ke.searchhouse.form.MapSearch;
import com.ke.searchhouse.form.RentSearch;
import com.ke.searchhouse.util.ServiceMultiResult;
import com.ke.searchhouse.util.ServiceResult;

import javax.transaction.Transactional;
import javax.validation.Valid;

/**
 * @author  keke
 * @create  2018/10/15 0015 下午 9:27
 * @desc 房屋管理服务接口
 **/
public interface IHouseService {

    ServiceResult<HouseDTO> save(HouseForm houseForm);

    ServiceMultiResult<HouseDTO> adminQuery(DatatableSearch searchBody);

    /**
     * 查询完整房源信息
     * @param id
     * @return
     */
    ServiceResult<HouseDTO> findCompleteOne(Long id);

    /**
     * 更新房源信息
     * @param houseForm
     * @return
     */
    ServiceResult update(@Valid HouseForm houseForm);

    /**
     * 删除照片
     * @param id
     * @return
     */
    ServiceResult removePhoto(Long id);

    /**
     * 更新封面
     * @param coverId
     * @param targetId
     * @return
     */
    ServiceResult updateCover(Long coverId, Long targetId);

    /**
     * 添加房屋标签
     * @param houseId
     * @param tag
     * @return
     */
    ServiceResult addTag(Long houseId, String tag);

    /**
     * 移除房屋标签
     * @param houseId
     * @param tag
     * @return
     */
    ServiceResult removeTag(Long houseId, String tag);

    @Transactional
    ServiceResult updateStatus(Long id, int status);

    ServiceMultiResult<HouseDTO> query(RentSearch rentSearch);

    /**
     * 全地图搜索
     * @param mapSearch {@link MapSearch}
     * @return
     */
    ServiceMultiResult<HouseDTO> wholeMapQuery(MapSearch mapSearch);

    /**
     * 精确范围查询
     * @param mapSearch {@link MapSearch}
     * @return
     */
    ServiceMultiResult<HouseDTO> boundMapQuery(MapSearch mapSearch);
}
